<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="gmms" uri="/gmms-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>菜单管理</title>
<script type="text/javascript" src="<%=path %>/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%=path %>/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=path %>/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="<%=path %>/js/layer/layer.min.js"></script>
<script type="text/javascript" src="<%=path %>/js/jefActionRow.js"></script>
<script type="text/javascript" src="<%=path %>/js/common.js"></script>
<script type="text/javascript" src="<%=path %>/js/nfpDrag.js"></script>
<script type="text/javascript" src="<%=path %>/js/blackbox/js/jquery.blackbox.min.js"></script>
<script type="text/javascript" src="<%=path %>/js/toastr/toastr.js"></script>
<link rel="stylesheet" href="<%=path %>/js/bootstrap/css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="<%=path %>/js/layer/skin/layer.css" type="text/css"></link>
<link rel="stylesheet" href="<%=path %>/js/blackbox/css/blackbox.css" type="text/css" />
<link rel="stylesheet" href="<%=path %>/js/toastr/toastr.css" type="text/css" />
<link rel="stylesheet" href="<%=path %>/main.css" type="text/css" />
<link rel="stylesheet" href="<%=path %>/css/style.css" type="text/css" />
<script language="javascript">
	$(function(){
		$(".info_right_main td").css({"border":"none"});
	});
	//通用TIP提示方法
	function j_tip(message,type){
		if(type== undefined || type==null){
			toastr.info(message);
		}else if(type=="error"){
			toastr.error(message);
		}else if(type=="success"){
			toastr.success(message);
		}else if(type=="warning"){
			toastr.warning(message);
		}else{
			toastr.info(message);
		}
	}
	function addOftenApps(menuId){
		 $.ajax({
				url			:"<%=path%>/usermenuconfig/usermenuconfigAjax_addOftenApps_menuAction.action",
				type 		: "POST",
				dataType 	: "json",
				data		: {
					"menuId" : menuId
				},
				success 	: function(data) {
					if(data.menuDesc==""){
						if($(".oftenAppsTr>:first").length!=0){
							$(".oftenAppsTr>:first").before('<td class="oftenAppsTd'+data.menuId+'" align="center"  style="border: medium none;padding-top:15px;">'
									+'<div  class="imageBoxItem" onmouseover="showObj(this);" onmouseout="hideObj(this);" style="padding-top:10px;">'
									+'<a class="main_right_cell rightMenu" style="background-image: url(<%=path%>/images/'+data.menuIcon+' );" target="_parent" href="<%=path %>/main_info.action?parentMenuId='+data.parentMenuId+'&currentMenuId='+data.menuId+'">'+data.menuName+'</a>'
									+'<span class="diagnoseItem" style="display:none;" title="从常用菜单中移除" onclick="moveOftenApps('+data.menuId+')"><img src="<%=path %>/images/move.png"/></span>'
									+'</div></td>');
						}else{
							$(".oftenAppsTr").html('<td class="oftenAppsTd'+data.menuId+'" align="center"  style="border: medium none;padding-top:15px;">'
									+'<div  class="imageBoxItem" onmouseover="showObj(this);" onmouseout="hideObj(this);" style="padding-top:10px;">'
									+'<a class="main_right_cell rightMenu" style="background-image: url(<%=path%>/images/'+data.menuIcon+' );" target="_parent" href="<%=path %>/main_info.action?parentMenuId='+data.parentMenuId+'&currentMenuId='+data.menuId+'">'+data.menuName+'</a>'
									+'<span class="diagnoseItem" style="display:none;" title="从常用菜单中移除" onclick="moveOftenApps('+data.menuId+')"><img src="<%=path %>/images/move.png"/></span>'
									+'</div></td>');
						}
					}else{
						j_tip(data.menuDesc, "warning");
					}
				},
				error		:function(){
					xbox.alert("数据正在提交，请稍候，或检查您的网络环境,确保其连接正常！");
				}
			});
	}
	function moveOftenApps(menuId){
		$.ajax({
			url			:"<%=path%>/usermenuconfig/usermenuconfigAjax_moveOftenApps_menuAction.action",
			type 		: "POST",
			dataType 	: "json",
			data		: {
				"menuId" : menuId
			},
			success 	: function(data) {
				$(".oftenAppsTd"+data.menuId).remove();
			},
			error		:function(){
				xbox.alert("数据正在提交，请稍候，或检查您的网络环境,确保其连接正常！");
			}
		});
	}
	function showObj(obj){
		$(obj).find(".diagnoseItem").show();
	}
	function hideObj(obj){
		$(obj).find(".diagnoseItem").hide();
	}
</script>

<style type="text/css">
.imageBoxItem{overflow: hidden;position: relative;}
.diagnoseItem{display: block;;height: 24px;position: absolute;right:0px;top:0px;width: 24px;cursor: pointer;}

</style>
</head>
<body>


<div class="info_right_main">

	        <div class="main_main">
  				<div class="main_right" style="padding-left:15px;padding-bottom:15px;background-color:#CCC;width:770px;">
	        	<table border="0" cellspacing="0" cellpadding="0" style="background-color:#CCC;">
					<tr class="oftenAppsTr" style="height:50px;">
						<c:forEach items="${oftenAppsList }" var="oftenApps">
						<td class="oftenAppsTd${oftenApps.menu.menuId }" align="center"  style="border: medium none;padding-top:15px;">
										<div  class="imageBoxItem" onmouseover="showObj(this);" onmouseout="hideObj(this);" style="padding-top:10px;">
											<a class="main_right_cell rightMenu" style="background-image: url(<%=path%>/images/${oftenApps.menu.menuIcon} );" target="_parent" href="<%=path %>/main_info.action?parentMenuId=${oftenApps.menu.parentMenuId}&currentMenuId=${oftenApps.menu.menuId}">${oftenApps.menu.menuName}</a>
											<span class="diagnoseItem" style="display:none;" title="从常用菜单中移除" onclick="moveOftenApps(${oftenApps.menu.menuId})"><img src="<%=path %>/images/move.png"/></span>
										</div>
						</td>
						</c:forEach>
					</tr>
				</table>	        
				</div>
			</div>

  <div class="main_main">
  	<div class="main_right" style="padding-left:65px;padding-top:10px;">
     <table id="gridTable" width="100%" border="0" cellspacing="0" cellpadding="0">
	       			<c:forEach items="${appsList}" var="menu" varStatus="status">
	       			<c:if test="${(status.index+7)%7==0 }"><tr align='center' bgcolor="#FFFFFF"></c:if>
						<td align="center"  style="border-bottom-width:0px;">
							<div  class="imageBoxItem" style="padding-top:10px;" onmouseover="showObj(this);" onmouseout="hideObj(this);">
							<a class="main_right_cell rightMenu" style="background-image: url(<%=path%>/images/${menu.menuIcon} );" target="_parent" href="<%=path %>/main_info.action?parentMenuId=${menu.parentMenuId}&currentMenuId=${menu.menuId}">${menu.menuName}</a>
							<span class="diagnoseItem" title="添加到常用菜单"  style="display:none;" onclick="addOftenApps(${menu.menuId})"><img src="<%=path %>/images/add.png"/></span>
							</div>
						</td>
					<c:if test="${(status.index+7)%7==6 }"></tr></c:if>
					</c:forEach>
     </table>
</div>
</div>
  
</div>

</body>
</html>
